package com.toolbox.alui.portalpages.browsing.portalprefs;

import com.plumtree.openfoundation.util.XPEncoding;
import com.plumtree.uiinfrastructure.activityspace.AActivitySpace;
import com.plumtree.uiinfrastructure.activityspace.IDisplayPage;
import com.plumtree.uiinfrastructure.activityspace.IWebData;
import com.plumtree.xpshared.htmlelements.*;

/**
 * 
 *
 * @author $author$
 */
public class PortalPrefsDP implements IDisplayPage
{
	
	public static final String STR_MVC_CLASS_NAME = "PortletPrefs";
	private AActivitySpace m_asOwner	    = null;
	private static final String strContentTypeHeaderName = "Content-Type";

	
	/**
	 * @see com.plumtree.portaluiinfrastructure.activityspace.IDisplayPage#GetName()
	 */
	public String GetName()
	{
		return STR_MVC_CLASS_NAME;
	}

	/**
	 * 
	 *
	 * @return 
	 *
	 * @throws HTMLException 
	 */
	public HTMLElement PageDisplay()
	{
		return null;
	}
	
	/**
	 * 
	 *
	 * @return 
	 */
	public AActivitySpace GetOwner()
	{
		return m_asOwner;
	}

	/**
	 * 
	 *
	 * @param parent 
	 */
	public void Init(AActivitySpace parent)
	{
		m_asOwner = parent;
	}

	/**
	 * 
	 *
	 * @param webData 
	 */
	public void Display(IWebData webData)
	{
		IPortalPrefsModelRO spModel = (IPortalPrefsModelRO) m_asOwner.GetModel(PortalPrefsModel.STR_MVC_CLASS_NAME);
		String strDisplayData = spModel.GetDisplayString();
		String strContentType = spModel.GetContentType();
		webData.SetHeader(strContentTypeHeaderName, strContentType);
		webData.SetData(XPEncoding.GetBytes( strDisplayData, "UTF-8" ));
	}
}

